package com.baseweb.webadmin.core.model.mapper;

import com.baseweb.webadmin.core.model.pojo.ByDict;
import com.baseweb.webadmin.core.model.pojo.ByDictExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ByDictMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    int countByExample(ByDictExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    int deleteByExample(ByDictExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    @Delete({
        "delete from by_dict",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    @Insert({
        "insert into by_dict (dict_type, dict_key, ",
        "dict_value, descn, ",
        "status, create_time, ",
        "update_time)",
        "values (#{dictType,jdbcType=INTEGER}, #{dictKey,jdbcType=VARCHAR}, ",
        "#{dictValue,jdbcType=VARCHAR}, #{descn,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(ByDict record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    int insertSelective(ByDict record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    List<ByDict> selectByExample(ByDictExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    @Select({
        "select",
        "id, dict_type, dict_key, dict_value, descn, status, create_time, update_time",
        "from by_dict",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ByDict selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    int updateByExampleSelective(@Param("record") ByDict record, @Param("example") ByDictExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    int updateByExample(@Param("record") ByDict record, @Param("example") ByDictExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    int updateByPrimaryKeySelective(ByDict record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table by_dict
     *
     * @mbggenerated Thu Feb 09 00:10:20 CST 2017
     */
    @Update({
        "update by_dict",
        "set dict_type = #{dictType,jdbcType=INTEGER},",
          "dict_key = #{dictKey,jdbcType=VARCHAR},",
          "dict_value = #{dictValue,jdbcType=VARCHAR},",
          "descn = #{descn,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ByDict record);
}